Optimal. Leaf size=112 \[ -\frac {2 \left (2 a^2-b^2\right ) \tan ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{b^3 d \sqrt {a-b} \sqrt {a+b}}+\frac {2 a x}{b^3}-\frac {a \sin (c+d x)}{b^2 d (a+b \cos (c+d x))}-\frac {\sin (c+d x)}{b^2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.26, antiderivative size = 112, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.161, Rules used = {3032, 3023, 2735, 2659, 205} \[ -\frac {2 \left (2 a^2-b^2\right ) \tan ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{b^3 d \sqrt {a-b} \sqrt {a+b}}-\frac {a \sin (c+d x)}{b^2 d (a+b \cos (c+d x))}+\frac {2 a x}{b^3}-\frac {\sin (c+d x)}{b^2 d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 205
Rule 2659
Rule 2735
Rule 3023
Rule 3032
Rubi steps
\begin {align*} \int \frac {\cos (c+d x) \left (1-\cos ^2(c+d x)\right )}{(a+b \cos (c+d x))^2} \, dx &=-\frac {a \sin (c+d x)}{b^2 d (a+b \cos (c+d x))}-\frac {\int \frac {-b \left (a^2-b^2\right )-a \left (a^2-b^2\right ) \cos (c+d x)+b \left (a^2-b^2\right ) \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx}{b^2 \left (a^2-b^2\right )}\\ &=-\frac {\sin (c+d x)}{b^2 d}-\frac {a \sin (c+d x)}{b^2 d (a+b \cos (c+d x))}-\frac {\int \frac {-b^2 \left (a^2-b^2\right )-2 a b \left (a^2-b^2\right ) \cos (c+d x)}{a+b \cos (c+d x)} \, dx}{b^3 \left (a^2-b^2\right )}\\ &=\frac {2 a x}{b^3}-\frac {\sin (c+d x)}{b^2 d}-\frac {a \sin (c+d x)}{b^2 d (a+b \cos (c+d x))}-\frac {\left (2 a^2-b^2\right ) \int \frac {1}{a+b \cos (c+d x)} \, dx}{b^3}\\ &=\frac {2 a x}{b^3}-\frac {\sin (c+d x)}{b^2 d}-\frac {a \sin (c+d x)}{b^2 d (a+b \cos (c+d x))}-\frac {\left (2 \left (2 a^2-b^2\right )\right ) \operatorname {Subst}\left (\int \frac {1}{a+b+(a-b) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{b^3 d}\\ &=\frac {2 a x}{b^3}-\frac {2 \left (2 a^2-b^2\right ) \tan ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} b^3 \sqrt {a+b} d}-\frac {\sin (c+d x)}{b^2 d}-\frac {a \sin (c+d x)}{b^2 d (a+b \cos (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 1.07, size = 132, normalized size = 1.18 \[ \frac {\frac {4 a^2 c+4 a^2 d x-4 a b \sin (c+d x)+4 a b (c+d x) \cos (c+d x)-b^2 \sin (2 (c+d x))}{a+b \cos (c+d x)}+\frac {4 \left (2 a^2-b^2\right ) \tanh ^{-1}\left (\frac {(a-b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {b^2-a^2}}\right )}{\sqrt {b^2-a^2}}}{2 b^3 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.50, size = 463, normalized size = 4.13 \[ \left [\frac {4 \, {\left (a^{3} b - a b^{3}\right )} d x \cos \left (d x + c\right ) + 4 \, {\left (a^{4} - a^{2} b^{2}\right )} d x + {\left (2 \, a^{3} - a b^{2} + {\left (2 \, a^{2} b - b^{3}\right )} \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) + {\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cos \left (d x + c\right ) + b\right )} \sin \left (d x + c\right ) - a^{2} + 2 \, b^{2}}{b^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + a^{2}}\right ) - 2 \, {\left (2 \, a^{3} b - 2 \, a b^{3} + {\left (a^{2} b^{2} - b^{4}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{2} b^{4} - b^{6}\right )} d \cos \left (d x + c\right ) + {\left (a^{3} b^{3} - a b^{5}\right )} d\right )}}, \frac {2 \, {\left (a^{3} b - a b^{3}\right )} d x \cos \left (d x + c\right ) + 2 \, {\left (a^{4} - a^{2} b^{2}\right )} d x - {\left (2 \, a^{3} - a b^{2} + {\left (2 \, a^{2} b - b^{3}\right )} \cos \left (d x + c\right )\right )} \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \cos \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \sin \left (d x + c\right )}\right ) - {\left (2 \, a^{3} b - 2 \, a b^{3} + {\left (a^{2} b^{2} - b^{4}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{{\left (a^{2} b^{4} - b^{6}\right )} d \cos \left (d x + c\right ) + {\left (a^{3} b^{3} - a b^{5}\right )} d}\right ] \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 3.93, size = 422, normalized size = 3.77 \[ -\frac {\frac {{\left (\sqrt {a^{2} - b^{2}} {\left (2 \, a - b\right )} {\left | -a + b \right |} {\left | b \right |} + {\left (4 \, a^{2} - 2 \, a b - b^{2}\right )} \sqrt {a^{2} - b^{2}} {\left | -a + b \right |}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {\frac {a b^{2} + \sqrt {a^{2} b^{4} - {\left (a b^{2} + b^{3}\right )} {\left (a b^{2} - b^{3}\right )}}}{a b^{2} - b^{3}}}}\right )\right )}}{{\left (a^{2} b^{2} - 2 \, a b^{3} + b^{4}\right )} b^{2} + {\left (a^{3} b^{2} - 2 \, a^{2} b^{3} + a b^{4}\right )} {\left | b \right |}} + \frac {{\left (4 \, a^{2} - 2 \, a b - b^{2} - 2 \, a {\left | b \right |} + b {\left | b \right |}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {\frac {a b^{2} - \sqrt {a^{2} b^{4} - {\left (a b^{2} + b^{3}\right )} {\left (a b^{2} - b^{3}\right )}}}{a b^{2} - b^{3}}}}\right )\right )}}{b^{4} - a b^{2} {\left | b \right |}} + \frac {2 \, {\left (2 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 2 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 2 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + a + b\right )} b^{2}}}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.09, size = 198, normalized size = 1.77 \[ -\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d \,b^{2} \left (a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b +a +b \right )}-\frac {4 a^{2} \arctan \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{d \,b^{3} \sqrt {\left (a -b \right ) \left (a +b \right )}}+\frac {2 \arctan \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{d b \sqrt {\left (a -b \right ) \left (a +b \right )}}-\frac {2 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d \,b^{2} \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}+\frac {4 \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) a}{d \,b^{3}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 1.76, size = 314, normalized size = 2.80 \[ \frac {4\,a\,\mathrm {atan}\left (\frac {128\,a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{128\,a-\frac {128\,a^2}{b}}-\frac {128\,a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{128\,a\,b-128\,a^2}\right )}{b^3\,d}-\frac {\frac {2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (2\,a-b\right )}{b^2}+\frac {2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (2\,a+b\right )}{b^2}}{d\,\left (\left (a-b\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+2\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+a+b\right )}-\frac {\ln \left (b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )-a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+\sqrt {b^2-a^2}\right )\,\sqrt {-\left (a+b\right )\,\left (a-b\right )}\,\left (2\,a^2-b^2\right )}{d\,\left (b^5-a^2\,b^3\right )}-\frac {\ln \left (a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )-b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+\sqrt {b^2-a^2}\right )\,\left (2\,a^2\,\sqrt {b^2-a^2}-b^2\,\sqrt {b^2-a^2}\right )}{b^3\,d\,\left (a^2-b^2\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-1)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________